package com.nondo.rdp.finance.service.impl.setting.home;

import com.nondo.rdp.finance.domain.setting.home.SettingModuleProduct;
import com.nondo.rdp.finance.repository.setting.home.SettingModuleProductRepository;
import com.nondo.rdp.finance.service.setting.home.SettingModuleProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class SettingModuleProductServiceImpl implements SettingModuleProductService {
    @Autowired
    SettingModuleProductRepository settingModuleProductRepository;

    @Override
    public SettingModuleProduct findOne(Long id) {
        return this.settingModuleProductRepository.findOne(id);
    }

    @Override
    public SettingModuleProduct save(SettingModuleProduct settingModuleProduct) {
        return this.settingModuleProductRepository.save(settingModuleProduct);
    }

    @Override
    public void update(SettingModuleProduct settingModuleProduct) {
        this.settingModuleProductRepository.save(settingModuleProduct);
    }

    @Override
    public void delete(Long id) {
        this.settingModuleProductRepository.deleteById(id);
    }

    @Override
    public List<SettingModuleProduct> findAll(Sort sort) {
        return this.settingModuleProductRepository.findAllByDelFlag("0", sort);
    }
}